home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2886 < prev    next >
Encoding:
Text File  |  1996-08-06  |  983 b   |  46 lines

  1. Path: ix.netcom.com!netnews
  2. From: n4jvp@ix.netcom.com (n4jvp)
  3. Newsgroups: comp.lang.c++
  4. Subject: Ctors & member methods ?
  5. Date: Fri, 19 Jan 1996 22:19:44 GMT
  6. Organization: Netcom
  7. Message-ID: <3100187d.5776685@ixnews7.ix.netcom.com>
  8. NNTP-Posting-Host: ix-nas-nh1-01.ix.netcom.com
  9. X-NETCOM-Date: Fri Jan 19  2:29:42 PM PST 1996
  10. X-Newsreader: Forte Agent .99c/16.141
  11.  
  12.     I have a question concerning ctors. Can a ctor call a member
  13. method? 
  14.  
  15. class Foo
  16. {
  17.     public:
  18.         Foo(){};
  19.         Foo( int a );
  20.         ~Foo(){};
  21.         void setlist( Ptr * b, Ptr * w );
  22.     private:
  23.          ...
  24. }; 
  25.  
  26. Foo::Foo( int a )    // a is a boolean value
  27. {
  28.    for( int i=0; i<16; i++ )
  29.        if( a )                         // new data
  30.        {
  31.     do stuff and get 2 pointers;
  32.     bar( Ptr * b, Ptr *  w);
  33.        }
  34.        else                          // restored data
  35.        {
  36.     do other stuff and get 2 pointers;
  37.     bar( Ptr * b, Ptr *  w );
  38.        }
  39. }
  40.  
  41. void Foo::bar( Ptr * b, Ptr * w ) 
  42. {
  43.     do more stuff;
  44. }
  45.  
  46.